﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
    xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.PanoramaBackgrounds"
	xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
	x:Class="ActivityTracker.BackgroundSelection"
	Orientation="Portrait"
	shell:SystemTray.IsVisible="False">

	<phone:PhoneApplicationPage.Resources>
		<SampleData:PanoramaBackgrounds x:Key="PanoramaBackgrounds" d:IsDataSource="True"/>
		<DataTemplate x:Key="ItemTemplate">
			<Border x:Name="border" Width="218" Height="218" Margin="0,0,10,10">
				<Border.Resources>
					<Storyboard x:Name="Tilt">
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="image">
							<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1.073"/>
							<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="image">
							<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1.073"/>
							<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</Border.Resources>
				<Border.Projection>
					<PlaneProjection/>
				</Border.Projection>
				<Custom:Interaction.Triggers>
					<Custom:EventTrigger EventName="MouseLeftButtonDown">
						<im:ControlStoryboardAction Storyboard="{StaticResource Tilt}"/>
					</Custom:EventTrigger>
				</Custom:Interaction.Triggers>
				<Grid>
					<Image x:Name="image" Source="{Binding PanImage}" RenderTransformOrigin="0.5,0.5">
						<Image.RenderTransform>
							<CompositeTransform/>
						</Image.RenderTransform>
					</Image>
				</Grid>
			</Border>
		</DataTemplate>
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<toolkit:WrapPanel/>
		</ItemsPanelTemplate>
	</phone:PhoneApplicationPage.Resources>
	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>

	<!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" Background="{StaticResource bipivot}" DataContext="{Binding Source={StaticResource PanoramaBackgrounds}}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
            <RowDefinition Height="80"/>
		</Grid.RowDefinitions>
		
		<!--TitlePanel contains the name of the application and page title-->
		<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Foreground="White" Text="ACTIVITY TRACKER - CHOOSE BACKGROUND" Style="{StaticResource PhoneTextNormalStyle}"/>
		</StackPanel>

		<!--ContentPanel - place additional content here-->
		<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <ListBox x:Name="ListBoxBackgrounds" ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding Collection}" ItemsPanel="{StaticResource ItemsPanelTemplate1}" SelectionChanged="ListBox_SelectionChanged" Margin="-11,0,11,26" />
		</Grid>
        <StackPanel Margin="0,0,0,0" Grid.Row="2">
            <my:AdControl  Margin="0,5,0,0" Height="80" HorizontalAlignment="Center" x:Name="adControl3" VerticalAlignment="Top" Width="480" ApplicationId="c8736437-6eec-403e-b9d4-333c4e6794d1" AdUnitId="28360" IsAutoRefreshEnabled="True" BorderBrush="Transparent"/>
        </StackPanel>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="uimage" IconUri="/Images/appbar.userimage.rest.png" Text="Custom" Click="ApplicationBarMenuItem_Click"/>

            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="User Images" Click="ApplicationBarMenuItem_Click"/>
               
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>